package com.hnkywl.sts.entity.jhgl;

import com.hnkywl.sts.entity.BaseEntity;
import com.hnkywl.sts.entity.htgl.Ht;
import com.hnkywl.sts.entity.organ.*;
import com.hnkywl.sts.entity.sys.Yg;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 采购物资计划
 * Created with IntelliJ IDEA.
 * User: ZHUCHG
 * Date: 13-4-1
 * Time: 下午9:20
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "T_BIZ_CGWZJH")
@Where(clause = "deleted!='1'")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "TYPE", discriminatorType = DiscriminatorType.STRING)
@DiscriminatorValue("Cgwzjh")
public class Cgwzjh extends BaseEntity {
    @Id
    @SequenceGenerator(name = "seqCgwzjh", allocationSize = 1, sequenceName = "SEQ_BIZ_CGWZJH")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqCgwzjh")
    private Long id;
    //计划编号
    private String jhbh;
    //协议
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "XY_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Xy xy;
    //合同
    @OneToMany(fetch = FetchType.LAZY, targetEntity = Ht.class, mappedBy = "wzjh")
    @NotFound(action = NotFoundAction.IGNORE)
    private List<Ht> htList;
    //需求年份
    @Column(length = 10)
    private String xqnf;
    //需求月份
    @Column(length = 10)
    private String xqyf;
    //需求日
    @Column(length = 10)
    private String xqr;
    //申报数量
    private Double sbsl;
    //路径
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "LJ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Lj lj;
    //供应商
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "GYS_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Qyjg gys;
    //申报公司
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SBGS_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Nbgs sbgs;
    //申报部门
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="SBBM_ID")
    @NotFound(action= NotFoundAction.IGNORE)
    private Nbbm sbbm;
    //制单人
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ZDR_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Yg zdr;
    //制单时间
    private Date zdsj = new Date();
    //计划数量
    private Double jhsl;
    //计划单位
    private String jhdw;
    //备注
    private String bz;

    //审批状态（已保存，已提交，已审批）   ybc ytj ysp
    private String zt = "ybc";

    // 关联流程
    @Column(name = "LC_ID")
    private String processInstanceId;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getJhbh() {
        return jhbh;
    }

    public void setJhbh(String jhbh) {
        this.jhbh = jhbh;
    }

    public Xy getXy() {
        return xy;
    }

    public void setXy(Xy xy) {
        this.xy = xy;
    }

    public List<Ht> getHtList() {
        return htList;
    }

    public void setHtList(List<Ht> htList) {
        this.htList = htList;
    }

    public String getXqnf() {
        return xqnf;
    }

    public void setXqnf(String xqnf) {
        this.xqnf = xqnf;
    }

    public String getXqyf() {
        return xqyf;
    }

    public void setXqyf(String xqyf) {
        this.xqyf = xqyf;
    }

    public String getXqr() {
        return xqr;
    }

    public void setXqr(String xqr) {
        this.xqr = xqr;
    }

    public Double getSbsl() {
        return sbsl;
    }

    public void setSbsl(Double sbsl) {
        this.sbsl = sbsl;
    }

    public Lj getLj() {
        return lj;
    }

    public void setLj(Lj lj) {
        this.lj = lj;
    }

    public Qyjg getGys() {
        return gys;
    }

    public void setGys(Qyjg gys) {
        this.gys = gys;
    }

    public Nbgs getSbgs() {
        return sbgs;
    }

    public void setSbgs(Nbgs sbgs) {
        this.sbgs = sbgs;
    }

    public Nbbm getSbbm() {
        return sbbm;
    }

    public void setSbbm(Nbbm sbbm) {
        this.sbbm = sbbm;
    }

//    public Gsjg getSbjg() {
//        return sbjg;
//    }
//
//    public void setSbjg(Gsjg sbjg) {
//        this.sbjg = sbjg;
//    }

    public Yg getZdr() {
        return zdr;
    }

    public void setZdr(Yg zdr) {
        this.zdr = zdr;
    }

    public Date getZdsj() {
        return zdsj;
    }

    public void setZdsj(Date zdsj) {
        this.zdsj = zdsj;
    }

    public Double getJhsl() {
        return jhsl;
    }

    public void setJhsl(Double jhsl) {
        this.jhsl = jhsl;
    }

    public String getJhdw() {
        return jhdw;
    }

    public void setJhdw(String jhdw) {
        this.jhdw = jhdw;
    }

    public String getBz() {
        return bz;
    }

    public void setBz(String bz) {
        this.bz = bz;
    }

    public String getZt() {
        return zt;
    }

    public void setZt(String zt) {
        this.zt = zt;
    }

    public String getProcessInstanceId() {
        return processInstanceId;
    }

    public void setProcessInstanceId(String processInstanceId) {
        this.processInstanceId = processInstanceId;
    }
}
